package execption;

public class TryCatchDemo {
    public static void main(String[] args) {
        try {
            String line=null;
            System.out.println(line.length());
            String line1="";
            System.out.println(line1.charAt(0));
            String line2="abc";
            System.out.println(Integer.parseInt(line2));
        }catch (NullPointerException e){
            System.out.println("出现空指针异常并解决");
        }catch (StringIndexOutOfBoundsException e){
            System.out.println("");
        }catch (Exception e){
            System.out.println("");
        }
        System.out.println("结束");


        /*System.out.println("开始");
        try{
            String ling=null;
            System.out.println(ling.length());
        }catch (NullPointerException e){
            System.out.println("出现问题，并解决");//针对try中出现的空指针异常的解决方法
        }

        System.out.println("结束");*/
    }
}
